package com.atguigu.gulimall.search.respository;

import com.atguigu.gulimall.search.bean.Person;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;

/**
 * @author nicc
 * @version 1.0
 * @className PersonRepository
 * @date 2022-10-13 03:58
 *
 * 简单的CRUD；
 * 复杂的CRUD； SQL、DSL（领域对象和语言, es检索领域专用语法）
 */
@Repository
public interface PersonRepository extends ElasticsearchRepository<Person, Long> {

    List<Person> getAllByUsernameLikeAndAgeGreaterThanEqual(String username, Integer age);

    List<Person> findAllByBirthDayBetween(Date birthDay, Date birthDay2);

    Long countAllByAddressLike(String address);
}
